]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shellEntry: Handle PasswordEntries automatically
authorUmang Jain <mailumangjain@gmail.com>
Thu, 12 Dec 2019 09:08:42 +0000 (14:38 +0530)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 17 Dec 2019 22:08:43 +0000 (23:08 +0100)
shellEntry should not need to query the clutter-text directly
in order to know if the entry is for passport-input purpose.
shellEntry can easily determine a password-entry by querying
if it is an instance of StPasswordEntry and use it's API
whereever relevant.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619

js/ui/shellEntry.js

index f7961af394f1240defa4efaebe9f9113e2132bb7..79a38bf56c8fbccf96beada9a44ce1511ed25671 100644 (file)
@@ -27,7 +27,8 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
         this.addMenuItem(item);
         this._pasteItem = item;
 
-        this._passwordItem = null;
+        if (entry instanceof St.PasswordEntry)
+            this._makePasswordItem();
 
         Main.uiGroup.add_actor(this.actor);
         this.actor.hide();
@@ -86,8 +87,7 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
     }
 
     _updatePasswordItem() {
-        let textHidden = this._entry.clutter_text.password_char;
-        if (textHidden)
+        if (!this._entry.password_visible)
             this._passwordItem.label.set_text(_("Show Text"));
         else
             this._passwordItem.label.set_text(_("Hide Text"));
@@ -110,8 +110,7 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
     }
 
     _onPasswordActivated() {
-        let visible = !!this._entry.clutter_text.password_char;
-        this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
+        this._entry.password_visible  = !this._entry.password_visible;
     }
 };